home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12088 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: noc.netcom.net!news
  2. From: Tarang Deshpande <tarang@willows.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Debugging an optimizaed code
  5. Date: Thu, 28 Mar 1996 14:14:18 -0800
  6. Organization: NETCOM Network Operations
  7. Message-ID: <315B0F3A.7B07@willows.com>
  8. References: <4j3ssc$ri5@geraldo.cc.utexas.edu>
  9. NNTP-Posting-Host: daffy.willows.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
  14.  
  15. wkshih@utpapa.ph.utexas.edu wrote:
  16. > Hi,
  17. > I have a program that crashes when compiled with -O on an IBM machine.
  18. > I have been trying to locate the problem by printing out some variable
  19. > values.  But I found that it is nearly impossible since the point it
  20. > crashed moved around when new printf statements were inserted.  I was
  21. > compiling with xlc.  -O is equivalent to -O2, which is the lowest level
  22. > of optimization according to the man page.  Of course, the code works
  23. > fine without -O.  Even on a sun workstation the optimized code runs ok.
  24. > I would very much appreciate it if somebody can help me out.  Thanks!
  25.  
  26.  
  27. Unless there is a compiler bug, which I doubt, the bug is acutally in
  28. your program and it exists both in the non-optimized and sun versions.
  29. Just because the bug appears not to do any harm does not mean it is
  30. not there.  Somewhere you are likely overwriting memory that you should
  31. not.  This is one of the most difficult bugs to root out.  If you can
  32. possibly move the code to a PC I reccomend you do so.  Make sure that
  33. when you compile it that the byte allignment is set to 1.  Your bug
  34. is likely to show itself much easier.
  35.